// ReSharper disable RedundantUsingDirective
// ReSharper disable DoNotCallOverridableMethodsInConstructor
// ReSharper disable InconsistentNaming
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable PartialMethodWithSinglePart
// ReSharper disable RedundantNameQualifier

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
//using DatabaseGeneratedOption = System.ComponentModel.DataAnnotations.DatabaseGeneratedOption;

namespace wUniApp.MVC.App_Data
{
    public partial class DbContextBase : DbContext, IDbContextBase
    {
        public IDbSet<Customer> Customers { get; set; } // Customers
        public IDbSet<Execution> Executions { get; set; } // Executions
        public IDbSet<InheritanceProcedure> InheritanceProcedures { get; set; } // InheritanceProcedures
        public IDbSet<Product> Products { get; set; } // Products

        static DbContextBase()
        {
            Database.SetInitializer<DbContextBase>(null);
        }

        public DbContextBase()
            : base("Name=DefaultConnection")
        {
        InitializePartial();
        }

        public DbContextBase(string connectionString) : base(connectionString)
        {
        InitializePartial();
        }

        public DbContextBase(string connectionString, System.Data.Entity.Infrastructure.DbCompiledModel model) : base(connectionString, model)
        {
        InitializePartial();
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Configurations.Add(new CustomerConfiguration());
            modelBuilder.Configurations.Add(new ExecutionConfiguration());
            modelBuilder.Configurations.Add(new InheritanceProcedureConfiguration());
            modelBuilder.Configurations.Add(new ProductConfiguration());
        OnModelCreatingPartial(modelBuilder);
        }

        public static DbModelBuilder CreateModel(DbModelBuilder modelBuilder, string schema)
        {
            modelBuilder.Configurations.Add(new CustomerConfiguration(schema));
            modelBuilder.Configurations.Add(new ExecutionConfiguration(schema));
            modelBuilder.Configurations.Add(new InheritanceProcedureConfiguration(schema));
            modelBuilder.Configurations.Add(new ProductConfiguration(schema));
            return modelBuilder;
        }

        partial void InitializePartial();
        partial void OnModelCreatingPartial(DbModelBuilder modelBuilder);
    }
}
